package com.oa.controller;

import com.oa.po.Leave;
import com.oa.po.Tbl_card_replacement;
import com.oa.service.CardReplacementSrevice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

//补卡
@RestController
public class CardReplacementController {
    @Autowired
    CardReplacementSrevice cardReplacementSrevice;
    //提交补卡申请接口
    @RequestMapping(value = "/card",method = RequestMethod.POST)
    public int addCard(Tbl_card_replacement tbl_card_replacement){

        return cardReplacementSrevice.addCard(tbl_card_replacement);

    }
//根据登录的用户名查询补卡申请表
    @RequestMapping(value = "/listcard",method = RequestMethod.POST)
    public List<Tbl_card_replacement> list_card(@RequestBody Map map){
        String s=(String) map.get("user_name");
        return cardReplacementSrevice.findByUsername(s);


    }
}
